package com.room2.ui;

import com.room2.App;
import com.room2.model.User;
import com.room2.model.UserDao;

import java.util.List;

import androidx.lifecycle.LiveData;

public class UserRepository {

    private UserDao userDao;
    public LiveData<List<User>> getAllData;

    public UserRepository() {
        userDao = App.APP_DATABASE.getUserDao();
        getAllData = userDao.getAllData();
    }

    public void insert(User... users) {
        userDao.insert(users);
    }

    public void update(User... users) {
        userDao.update(users);
    }

    public void delete(String name) {
        userDao.delete(name);
    }

    public void clear() {
        userDao.clear();
    }
}
